/**
 * 
 */
package com.zxc.mvel;

import java.util.HashMap;
import java.util.Map;

import org.mvel2.MVEL;

/**
 * @author Administrator
 *
 */
public class MVELDemo {

	public static void main(String[] args) {
		Map<String, Object> vars = new HashMap<String, Object>();
		vars.put("order", 1);
		vars.put("channel", 2);
		String expression = "order - channel > 0 ? true : false";
		
		System.out.println(MVEL.evalToString(expression, vars));
		
		vars = new HashMap<String, Object>();
		vars.put("x", 100000);
		expression = "200+(x-50000)*0.003";
		System.out.println(MVEL.evalToString(expression, vars));
		
		vars = new HashMap<String, Object>();
		vars.put("time", 365);
		expression = "time>=(14*24)";
		System.out.println(MVEL.evalToString(expression,vars));
		
		System.out.println(MVEL.eval("(14*24)"));
	}
}
